#! /bin/bash
export LANG='en_US.UTF-8'
ROOT_HOME=$(_pwd=`dirname $0`;cd $_pwd;cd ./;pwd)
echo 'ROOT_HOME='$ROOT_HOME
#打包路径
mvn clean  package
echo 'over'

echo '执行脚本 server='$1 ",env="$2

JENKINS_HOME="/jenkins-code/code/"$2"/java/xinyingfei-risk-engine/out"
mkdir -p $JENKINS_HOME
ls -l $JENKINS_HOME

rm -rf $JENKINS_HOME
mkdir -p $JENKINS_HOME
ls -l $JENKINS_HOME


if [ $1 == xdecision-engine-server ];then
    mvn clean install  -DskipTests=true  -P  $2  -pl "!xdecision-server/xdecision-data-server,!xdecision-server/xdecision-exam-server,!xdecision-server/xdecision-manager-web"
elif [ $1 == xdecision-data-server ];then
    mvn clean install  -DskipTests=true  -P  $2  -pl  "!xdecision-server/xdecision-engine-server,!xdecision-server/xdecision-exam-server,!xdecision-server/xdecision-manager-web"
elif [ $1 == xdecision-exam-server ];then
    mvn clean install  -DskipTests=true  -P  $2  -pl  "!xdecision-server/xdecision-data-server,!xdecision-server/xdecision-engine-server,!xdecision-server/xdecision-manager-web"
elif [ $1 == xdecision-manager-web ];then
    mvn clean install  -DskipTests=true  -P  $2  -pl  "!xdecision-server/xdecision-data-server,!xdecision-server/xdecision-exam-server,!xdecision-server/xdecision-engine-server"
else
     echo '未知的项目名词 '  $1
     exit 3
fi
pwd
echo 'mvn clean  install deploy -Dmaven.skip.test=true -P '$2

#mvn clean install deploy -DskipTests=true  -P  $2

cd $ROOT_HOME

ls -l $JENKINS_HOME
#tar xvf $JENKINS_HOME/$1.tar -C $JENKINS_HOME
#ls -l $JENKINS_HOME/*

echo '===================over========================='
